package org.mx.dal.hibernate.single.entity;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import org.mx.dal.entity.BaseDict;
import org.mx.dal.hibernate.entity.BaseDictEntity;

import lombok.Getter;
import lombok.Setter;

@SuppressWarnings("javadoc")
@Entity(name = "Account")
@Table(name = "TB_ACCOUNT")
@Getter
@Setter 
public class AccountEntity extends BaseDictEntity implements BaseDict {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2834008966711730765L;

	@ManyToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	@JoinTable(name = "TB_ACCOUNT_ROLE", joinColumns = { @JoinColumn(name = "ACCOUNT_ID") }, inverseJoinColumns = {
			@JoinColumn(name = "ROLE_ID") })
	private Set<RoleEntity> roles = new HashSet<>();
}
